
public class DummyHeadList {
    private int size;
    private Node dummyHead;
    /**
     * Node
     */
    class Node {
        private E e;
        private Node next;
        Node(E e,Node next){
            this.e=e;
            this.next=next;
        }
        Node(E e){
           this(e,null);
        }
        Node(Node next){
            this(null,next);
        }
    }
    DummyHeadList(){
        this.dummyHead=new Node(null,null);
        this.size=0;
    }
    public int getSize(){
        return size;
    }
    E get(int idx){
        Node currentNode=dummyHead;
        for (int i = 0; i <this.getSize(); i++) {
            currentNode=currentNode.next;
        }  
        return currentNode.e;
    }
    boolean contain(E e){
        Node currentNode=dummyHead.next;
        while(currentNode!=null){
            if (currentNode.e==e){
                return true;
                }
            currentNode=currentNode.next;
            }
        return false;
    }
    void set(E e, int idx){
        Node node=this.get(idx);
        node.e=e;
    }
}